<?php

/**
 * XHTML Document, Head > Meta
 * 
 * @package Core
 * @subpackage Document
 *
 */
class Lead_Controller_Response_Document_Head_Meta extends Lead_Controller_Response_Document_Head_Part 
{
	
	/**
	 * Meta information
	 *
	 * @var array
	 */
	protected $metas = array();
	/**
	 * Meta types
	 *
	 * @var unknown_type
	 */
	protected $metatypes = array(0 => 'name', 1 => 'http-equiv');
			
	/**
	 * Adds meta data.
	 *
	 * @param string $key Key
	 * @param string $value Value
	 * @param integer $as_http_equiv 0 => name, 1 => http_equiv
	 */
	function add($key, $value, $as_http_equiv = 0)
	{
		$this->metas[$key] = array('value' => $value, 'as_http_equiv' => $as_http_equiv);
	}
	
	
	/**
	 * Renders metadata
	 *
	 * @return unknown
	 */
	function render()
	{
		$output = array();
		foreach($this->metas as $metakey => &$metavalue)
		{
			$output[] = "<meta {$this->metatypes[$metavalue['as_http_equiv']]}=\"{$metakey}\" content=\"{$metavalue['value']}\" />";
		}

		return implode("\n", $output);
		
	}
	
	
	
	
}
?>